<?php 
include("conn.php");
mysql_query('SET NAMES UTF8'); 

	  

class MyPrizeBean
{
	public $code;

	function __construct($code)
	{
		$this->code      = $code;
	}
}


$state='7';

$ordersid = explode(',', $_REQUEST[ordersid]);
$len = count($ordersid);
$flag = true;
for ($i=0; $i < $len; $i++) {
	// 调用信息推送接口
	$url = "http://120.24.0.10/xzpf/api/jpush/jpush.php?state=".$state."&ordersid=".$ordersid[$i];
	file_get_contents($url);
	// 调用信息推送接口 end
	$query = mysql_query("UPDATE goodsorders set state='".$state."' where ordersid='".$ordersid[$i]."'");
	if (!$query) {
		$flag = false;
	}
}
if ($flag == true) {
	$codes=100;
}else{
	$codes=300;
}
// $query=mysql_query("select * from goodsorders where ordersid='".$_REQUEST[numbers]."'");
// if ($result=mysql_fetch_array($query)){
// 	$srat1=mysql_query("UPDATE goodsorders set state='".$state."' where numbers='".$_REQUEST[numbers]."'");
// 	if ($srat1==true) {
// 		$codes=100;
// 	}else{
// 		$codes=300;
// 	}
// }else{
// 	$codes=200;
// }
$prize[] = new MyPrizeBean($codes);

echo json_encode($prize);


?>